﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;

namespace V5_EShop.Pay
{
    public class HaoduoPay
    {
        public string CreateUrl(
            string _customerNumber,
            string _requestId,
            string _productName,
            string _amount,
            string _orderType,
            string _notifyUrl,
            string _username,
            string _password,
            string _passwordType,
            string _hmac
            )
        {
            int i;
            //构造数组；
            string[] Sortedstr ={ 
                "customerNumber="+_customerNumber, 
                "requestId=" + _requestId, 
                "productName=" + _productName, 
                "amount=" + _amount, 
                "orderType=" + _orderType, 
                "notifyUrl=" + _notifyUrl, 
                "username=" + _username,  
                "password=" + _password, 
                "passwordType=" + _passwordType, 
                "hmac=" + _hmac
                };
            StringBuilder prestr = new StringBuilder();
            for (i = 0; i < Sortedstr.Length; i++)
            {
                if (i == Sortedstr.Length - 1)
                {
                    prestr.Append(Sortedstr[i]);

                }
                else
                {

                    prestr.Append(Sortedstr[i] + "&");
                }
            }
            return prestr.ToString();
        }
    }
}
